package pe.tp2.dao.implementacion;


import java.util.ArrayList;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.ibatis.dao.client.DaoManager;
import com.ibatis.dao.client.template.SqlMapDaoTemplate;

import pe.tp2.beans.DetalleEmbarque;
import pe.tp2.beans.DetalleParametro;
import pe.tp2.beans.Tender;
import pe.tp2.beans.Embarque;



public class ImplTenderDAO extends SqlMapClientDaoSupport implements ITenderDAO{

	@Override
	public ArrayList<Tender> buscarTender(Tender objTender) throws Exception {
		ArrayList<Tender> lstTender = (ArrayList<Tender>)getSqlMapClient().queryForList("buscarTender",objTender);
		return lstTender;
	}

	@Override
	public ArrayList<Embarque> buscarEmbarques(Embarque objEmbarque) throws Exception {
		ArrayList<Embarque> lstEmbarque = (ArrayList<Embarque>)getSqlMapClient().queryForList("buscarEmbarque",objEmbarque);
		return lstEmbarque;
	}

	@Override
	public ArrayList<DetalleEmbarque> buscarDetalleEmbarque(Embarque objEmbarque)
			throws Exception {
		ArrayList<DetalleEmbarque> lstDetalleEmbarque = (ArrayList<DetalleEmbarque>)getSqlMapClient().queryForList("buscarDetalleEmbarque",objEmbarque);
		return lstDetalleEmbarque;
	}

	@Override
	public ArrayList<DetalleParametro> buscarDetalleParametro(int idDetalle)
			throws Exception {
		ArrayList<DetalleParametro> lstDetalleParametro = (ArrayList<DetalleParametro>)getSqlMapClient().queryForList("buscarDetalleParametro",idDetalle); 
		return lstDetalleParametro;
	}

	@Override
	public boolean actualizarEmbarque(Embarque objEmbarque) throws Exception {
		// TODO Auto-generated method stub
		getSqlMapClient().update("actualizarEstadoEmbarque",objEmbarque);
		//getSqlMapClient().commitTransaction();
		return true;
	}

	@Override
	public boolean registraTender(Tender objTender) throws Exception {
		// TODO Auto-generated method stub
		getSqlMapClient().insert("registrarTender",objTender);
		return true;
	}

	
}
